<?php
defined('IN_YuLin') || exit('NO PERMIT!');

$sql = "SELECT u.username,
		CASE u.status
			WHEN 1 THEN
				'正常'
			ELSE
				'锁定'
		END AS status,
		ml.lkey,ml.money,ml.dateline
		FROM yulin_user_money_log AS ml
		LEFT JOIN yulin_user AS u
		ON ml.uid = u.id
		WHERE ml.tid = 'user_index_add'";

$where = "";
$username = NoBadStr($_GET['username']);
$username && $where .= " and u.username = '".$username."'";

$lkey = NoBadStr($_GET['lkey']);
$lkey && $where .= " and ml.lkey = '".$lkey."'";

$begintime = NoBadStr($_GET['begintime']);
$begintime && $where .= " and ml.dateline > ".strtotime($begintime);

$endtime = NoBadStr($_GET['endtime']);
$endtime && $where .= " and ml.dateline < ".strtotime($endtime);

$sql .= $where;
$rows = $db->affected_rows($sql);
if($rows){
	$page = max(1, intval($_GET['page']));
	$size = 20;
	$url = "?m=".$m."&c=".$c."&a=".$a."&username=".$username."&lkey=".$lkey."&begintime=".$begintime."&endtime=".$endtime;
	$sql .= " ORDER BY ml.id DESC LIMIT ".($page - 1) * $size.", ".$size;
	$data = $db->getall($sql);
	$multi = Multi($url, $page, $rows, $size);
}



$tpl->display($m.'/'.$c);
